package cn.acac.yygh.hosp.controller.admin;

import cn.acac.yygh.hosp.service.ScheduleService;
import cn.acac.yygh.model.hosp.Schedule;
import cn.acac.yygh.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 医院科室排班相关操作
 */
@RestController
@Api("医院科室排班相关操作")
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    /**
     * 根据医院、科室、日期查询当日的医师
     * @param hoscode
     * @param depcode
     * @param workDate
     * @return
     */
    @GetMapping("/{hoscode}/{depcode}/{workDate}")
    public R detail(@PathVariable String hoscode,
                    @PathVariable String depcode,
                    @PathVariable String workDate){
        List<Schedule> scheduleList = scheduleService.dateil(hoscode,depcode,workDate);
        return R.ok().setData("scheduleList",scheduleList);
    }

    /**
     * 根据医院科室的信息查询排班信息
     * @param pageNum
     * @param pageSize
     * @param hoscode
     * @param depcode
     * @return
     */
    @ApiOperation("根据医院科室的信息查询排班信息")
    @GetMapping("/{pageNum}/{pageSize}/{hoscode}/{depcode}")
    public R schedulePage(@PathVariable Integer pageNum,
                          @PathVariable Integer pageSize,
                          @PathVariable String hoscode,
                          @PathVariable String depcode){
        Map<String,Object> map = scheduleService.schedulePage(pageNum,pageSize,hoscode,depcode);
        return R.ok().setData(map);
    }
}
